package org.jxy.study.rpc.controller;

import org.jxy.study.rpc.annotation.MyResource;
import org.jxy.study.rpc.annotation.RpcClientTarget;
import org.jxy.study.rpc.entity.UserInfo;
import org.jxy.study.rpc.service.HelloWorldService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author : porteryao
 * @description : 描述
 * @date : 2021/3/11 15:43
 */
@RestController
@RpcClientTarget
public class Instance2TestController {

    @MyResource
    private HelloWorldService helloWorldService;

    @GetMapping("/test")
    public String test() {
        UserInfo userInfo = new UserInfo();
        userInfo.setName("test");
        userInfo.setAge(5);
        String s = helloWorldService.registerUserInfo(userInfo);
        return helloWorldService.sayHello("client");
    }

    @GetMapping("/test2")
    public String test2() {
        UserInfo userInfo = new UserInfo();
        userInfo.setName("test");
        userInfo.setAge(5);
        String s = helloWorldService.registerUserInfo(userInfo);
        return s;
    }
}
